Answer:

Yes.

Video Store Example

Programming in Java consists mostly of creating class hierarchies and instantiating objects from them. The Java Development Kit gives you a rich collection of base classes that you can extend to do your work.

Here is a program that uses a class Video to represent videos available at a rental store. Inheritance is not explicitly used in this program (so far).

class Video
{
  String  title;    // name of the item
  int     length;   // number of minutes
  boolean avail;    // is the video in the store?

  // constructor
  public Video( String ttl )
  {
    title = ttl; length = 90; avail = true; 
  }

  // constructor
  public Video( String ttl, int lngth )
  {
    title = ttl; length = lngth; avail = true; 
  }

  public void show()
  {
    System.out.println( title + ", " + length + " min. available:" + avail );
  }
  
}

public class VideoStore
{
  public static void main ( String args[] )
  {
    Video item1 = new Video("Jaws", 120 );
    Video item2 = new Video("Star Wars" );

    item1.show();
    item2.show();
  }
}

You can copy this program to an editor, save it, and run it.

QUESTION 9:

What will this program print?